package ar.edu.sovietrussia.customcomponents.bookviews;

import java.util.Arrays;
import java.util.List;

import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

import ar.edu.sovietrussia.customcomponents.genericlistview.GenericDataTablePanel;
import dtos.BookInfoDTO;

/**
 */
public class BooksDataTable extends GenericDataTablePanel<BookInfoDTO> {

    private static final long serialVersionUID = 1L;

    public BooksDataTable(final String id, final List<BookInfoDTO> books) {
        super(id, books, Arrays.asList("title", "isbn"));
    }

    public void onDetailsLinkClicked(final BookInfoDTO book) {
        // redefinir
    }

    @Override
    protected Panel actionsPanel(final String componentId, final IModel<BookInfoDTO> rowModel) {
        BookActionsPanel panel = new BookActionsPanel(componentId, rowModel.getObject()) {

            private static final long serialVersionUID = 1940682220404582212L;

            @Override
            protected void onInfoLinkClicked(final BookInfoDTO book) {
                BooksDataTable.this.onDetailsLinkClicked(book);
            }
        };

        return panel;
    }

}
